﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using SelfService.Model.Interface;
using WalkingTec.Mvvm.Core;

namespace SelfService.Model.Models
{
    public class SysPrescription : BasePoco, IOrder
    {
        [Display(Name = "患者")]
        public SysPatient Patient  { get; set; }

        [Display(Name = "患者")]
        public Guid? PatientId { get; set; }

        [Display(Name = "就诊卡号")]
        [StringLength(128)]
        public string CardNo { get; set; }

        [Display(Name = "就诊流水号")]
        [StringLength(128)]
        public string Code { get; set; }
        
        [Display(Name = "结算流水号")]
        [StringLength(128)]
        public string TradeNo { get; set; }

        [Display(Name = "科室")]
        [StringLength(64)]
        public string Department { get; set; }

        [Display(Name = "医生")]
        [StringLength(64)]
        public string Doctor { get; set; }

        [Display(Name = "订单金额")]
        [Column(TypeName = "decimal(10,2)")]
        public decimal Amount { get; set; }

        [Display(Name = "缴费状态")]
        public SysOrderStatus Status { get; set; }

        [Display(Name = "原始数据")]
        public string RawData { get; set; }

        [Display(Name = "错误信息")]
        public string ErrorMessage { get; set; }

        [Display(Name = "支付订单")]
        public Guid? PayId { get; set; }

        [Display(Name = "支付订单")]
        public SysPay Pay { get; set; }
        
        /// <summary>
        /// 统筹支付
        /// </summary>
        [Display(Name = "统筹支付")]
        [Column(TypeName = "decimal(10,2)")]
        public decimal? FundAmount { get; set; }
        
        /// <summary>
        /// 账户支付
        /// </summary>
        [Display(Name = "个人账户支付")]
        [Column(TypeName = "decimal(10,2)")]
        public decimal? AccountAmount { get; set; }
        
        /// <summary>
        /// 报销金额
        /// </summary>
        [Display(Name = "报销金额")]
        [Column(TypeName = "decimal(10,2)")]
        public decimal? ReimbursementAmount { get; set; }
        
        /// <summary>
        /// 自付费用
        /// </summary>
        [Display(Name = "自付费用")]
        [Column(TypeName = "decimal(10,2)")]
        public decimal? SelfAmount { get; set; }
        
        /// <summary>
        /// 社保结算状态
        /// </summary>
        [Display(Name = "社保结算状态")]
        public SocialSecurityType SocialSecurityStatus { get; set; }
    }

    public enum SysOrderStatus
    {
        未缴费 = 0,
        缴费中 = 10,
        已缴费 = 20,
        缴费失败 = 30,
        退款中 = 21,
        退款完成 = 22,
        退款失败 = 23
    }
    
    public enum SocialSecurityType
    {
        未结算 = 0,
        预结算 = 1,
        结算 = 2,
        冲正成功 = 3,
        冲正失败 = 4,
        结算失败 = 5
    }
}
